package org.example.cake.config;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author 李丽君
 * @version 1.0
 * @Description Minio启动配置类
 * @date 2024/12/19 10:57
 */
@Component
@ConfigurationProperties(prefix = "minio")
public class MinIoClientConfig {
    @Value("${minio.server}")
    private String server;
    @Value("${minio.port}")
    private int port;
    @Value("http://localhost:9000")
    private String endpoint;
    @Value("FOOkT3WjTc0sUDUzfFMB")
    private String accessKey;
    @Value("PqZE8cAWhwSKcsicMlivfimfNIzEcVaQ8tgedKb3")
    private String secretKey;
    @Value("cake")
    private String bucket;
    /**
     * 创建minio连接对象
     * minio客户端对象
     * @return minio客户端对象
     */
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(server, port, false)
                .credentials(accessKey, secretKey)
                .build();
    }


}